import request from "@/utils/request";

// 字典设置

/**
 * 字典设置列表
 */
export function sysDictTypeList(params) {
  return request({
    url: "/sys-dict-type/list",
    method: "GET",
    params,
  });
}
/**
 * 新增
 */
export function sysDictTypeAdd(data) {
  return request({
    url: "/sys-dict-type",
    method: "post",
    data,
  });
}
/**
 * 删除
 */
export function sysDictTypeDel(id) {
  return request({
    url: `/sys-dict-type/${id}`,
    method: "DELETE",
  });
}
/**
 * 详情
 */
export function sysDictTypeDetail(id) {
  return request({
    url: `/sys-dict-type/${id}`,
    method: "get",
  });
}
/**
 * 编辑
 */
export function sysDictTypeEdit(data) {
  return request({
    url: "/sys-dict-type",
    method: "put",
    data,
  });
}
/**
 * 导出表格
 */
export function sysDictTypeExport(data) {
  return request({
    url: "/sys-dict-type/export",
    method: "post",
    data,
  });
}
/**
 * 刷新缓存
 */
export function sysDictTypeRefreshCache() {
  return request({
    url: `/sys-dict-type/refreshCache`,
    method: "DELETE",
  });
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// 字典数据

/**
 * 字典数据列表
 */
export function sysDictDataList(params) {
  return request({
    url: "/sys-dict-data/list",
    method: "GET",
    params,
  });
}
/**
 * 获取字典选择框列表
 * @param pram
 */
export function sysDictTypeOptionselect(params) {
  return request({
    url: "/sys-dict-type/optionselect",
    method: "GET",
    params,
  });
}
/**
 * 新增
 */
export function sysDictDataAdd(data) {
  return request({
    url: "/sys-dict-data",
    method: "post",
    data,
  });
}
/**
 * 删除
 */
export function sysDictDataDel(dictCodes) {
  return request({
    url: `/sys-dict-data/${dictCodes}`,
    method: "DELETE",
  });
}
/**
 * 详情
 */
export function sysDictDataDetail(dictCode) {
  return request({
    url: `/sys-dict-data/${dictCode}`,
    method: "get",
  });
}
/**
 * 编辑
 */
export function sysDictDataEdit(data) {
  return request({
    url: "/sys-dict-data",
    method: "put",
    data,
  });
}
/**
 * 导出表格
 */
export function sysDictDataExport(data) {
  return request({
    url: "/sys-dict-data/export",
    method: "post",
    data,
  });
}
